<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="用户姓名">
              <a-input placeholder="请输入用户姓名" v-model="queryParam.nickname"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="用户手机号">
              <a-input placeholder="请输入用户手机号" v-model="queryParam.mobile"></a-input>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="医生姓名">
              <a-input placeholder="请输入医生姓名" v-model="queryParam.doctorName"></a-input>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
        <span style="float:right;">
          <a @click="loadData()"><a-icon type="sync" />刷新</a>
        </span>
      </div>

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
<!--          <a @click="detail(record)">详情</a>-->
<!--          <a-divider type="vertical" />-->
            <a @click="handleWxUser(record)">查看详情</a>
        </span>
      </a-table>
    </div>
    <wx-user-list-modal ref="wxUserListModal"></wx-user-list-modal>
    <wx-userinfo-modal ref="modalForm" @ok="modalFormOk"></wx-userinfo-modal>
  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import WxUserinfoModal from './WxUserinfoModal'
import WxUserListModal from './modules/WxUserListModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
import Area from '@/components/_util/Area'

export default {
  name: 'WxUserinfoList',
  mixins:[JeecgListMixin, mixinDevice],
  components: {
    WxUserinfoModal,
    WxUserListModal
  },
  data () {
    return {
      description: 'wx_userinfo管理页面',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key:'rowIndex',
          width:60,
          align:"center",
          customRender:function (t,r,index) {
            return parseInt(index)+1;
          }
        },
        {
          title:'用户姓名',
          align:"center",
          dataIndex: 'nickname'
        },
        {
          title:'用户消费金额',
          align:"center",
          dataIndex: 'amount'
        },
        {
          title:'用户总订单数',
          align:"center",
          dataIndex: 'orderAll'
        },
        {
          title:'进行中订单数',
          align:"center",
          dataIndex: 'orderIng'
        },
        {
          title:'手机号',
          align:"center",
          dataIndex: 'mobile'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align:"center",
          fixed:"right",
          width:147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/wuser/wxUserinfo/list",
        delete: "/wuser/wxUserinfo/delete",
        deleteBatch: "/wuser/wxUserinfo/deleteBatch",
        exportXlsUrl: "/wuser/wxUserinfo/exportXls",
        importExcelUrl: "wuser/wxUserinfo/importExcel",
      },
      dictOptions:{},
      pcaData:''
    }
  },
  created() {
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
  },
  methods: {
    getPcaText(code){
      return this.pcaData.getText(code);
    },
    initDictConfig(){
    },

    detail(record){
      console.log(record)
      let id = record.id;
      this.$router.push(`/userData/${id}`)
    },
    // 详情
    handleWxUser(record){
      this.$refs.wxUserListModal.viewShow(record);
      // this.listModalVisible = false;
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>